package com.example.day10;

/**
 * @author Lenovo
 */
public class Person {
    private String name;
    private int age;
    public Person() {
    }
    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
}
class Teacher extends Person {
    public Teacher() {
    }
    public Teacher(String name, int age) {
        super(name, age);
    }
    public void teach() {
        System.out.println("老师在教学");
    }
}
class Student extends Person {
    public Student() {
    }
    public Student(String name, int age) {
        super(name, age);
    }
    public void study() {
        System.out.println("学生在学习");
    }
}
class PersonDemo {
    public static void main(String[] args) {
        //创建老师类对象并进行测试
        Teacher t1 = new Teacher();
        t1.setName("林青霞");
        t1.setAge(30);
        System.out.println(t1.getName() + "," + t1.getAge());
        t1.teach();
        Teacher t2 = new Teacher("风清扬", 33);
        System.out.println(t2.getName() + "," + t2.getAge());
        t2.teach();
        // 创建学生类对象测试
        Student s = new Student("张三",23);
        System.out.println(s.getName() + "," + s.getAge());
        s.study();
    }
}